# coding=utf-8
# @Time: 2023/2/20 12:50
# @Author: zyg
# email: zhaoyiguang@lecent.cn

import ddddocr

from logs.log import log


class OcrIdentify:
    # pass
    def __init__(self):
        self.ocr = ddddocr.DdddOcr()

    def identify(self, pic_path):
        log.info("图片验证码")
        with open(pic_path, 'rb') as f:
            image = f.read()
        res = self.ocr.classification(image)
        log.info("图片验证码为：" + str(res))
        return res


if __name__ == '__main__':
    print(OcrIdentify().identify("img.png"))
